/*
 * Selling Partner API for Notifications
 *
 * The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.  For more information, refer to the [Notifications Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide).
 *
 * The version of the OpenAPI document: v1
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.notifications.v1
{
    /// <summary>
    /// The information required to create an Amazon Simple Queue Service (Amazon SQS) queue destination.
    /// </summary>
    [DataContract(Name = "SqsResource")]
    public partial class SqsResource : IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SqsResource" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected SqsResource() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqsResource" /> class.
        /// </summary>
        /// <param name="arn">The Amazon Resource Name (ARN) associated with the SQS queue. (required).</param>
        public SqsResource(string arn = default(string))
        {
            // to ensure "arn" is required (not null)
            if (arn == null)
            {
                throw new ArgumentNullException("arn is a required property for SqsResource and cannot be null");
            }
            this.Arn = arn;
        }

        /// <summary>
        /// The Amazon Resource Name (ARN) associated with the SQS queue.
        /// </summary>
        /// <value>The Amazon Resource Name (ARN) associated with the SQS queue.</value>
        [DataMember(Name = "arn", IsRequired = true, EmitDefaultValue = true)]
        public string Arn { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class SqsResource {\n");
            sb.Append("  Arn: ").Append(Arn).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // Arn (string) maxLength
            if (this.Arn != null && this.Arn.Length > 1000)
            {
                yield return new ValidationResult("Invalid value for Arn, length must be less than 1000.", new [] { "Arn" });
            }

            if (this.Arn != null) {
                // Arn (string) pattern
                Regex regexArn = new Regex(@"^arn:aws:sqs:\S+:\S+:\S+", RegexOptions.CultureInvariant);
                if (!regexArn.Match(this.Arn).Success)
                {
                    yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Arn, must match a pattern of " + regexArn, new [] { "Arn" });
                }
            }

            yield break;
        }
    }

}
